package nancal.mp

import nancal.mp.db.redis.rer
import nbcp.base.event.SetValidateCodeEvent
import org.slf4j.LoggerFactory
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.context.event.EventListener

//@Configuration
class OrmInit {
    companion object {
        private val logger = LoggerFactory.getLogger(this::class.java.declaringClass)
    }

    @EventListener
    fun applicationStart(ev: ApplicationStartedEvent) {

//        MemoryCacheList.expireAfterWrite4Hours.get("sys_dict"){
//            return@get  db.morBase.sysDictionary
//                    .query()
//                    .where { it.group mongoEquals config.appGroup }
//                    .toList()
//        }
    }


    @EventListener
    fun setValidate(ev: SetValidateCodeEvent) {
        rer.sys.imgValidateCode(ev.token).set(ev.result)
    }

}